<?php
/* 
  统计信息
    n 新闻
    n 页面
    n 分类
    n 商品
  
  主题 DEFAULT 
  
  最新留言
  
  热门商品
  
  热门页面
  
  热门新闻
  */

define('TITLE', '控制面板');

require('include/application_top.php');

redirect('./page.php');

  ?>
<?php include 'include/header.php';?>
<?php include 'include/column_left.php';?>
    <div id="right">
      <h2><?php echo TITLE;?></h2>
      <div id="site_information">
        <h3>网站状态</h3>
        <table id="site_information_table">
          <tr>
            <th>留言</th>
            <td><?php echo get_messages_count('unread');?>未读</td>
            <td><?php echo get_messages_count('readed');?>已读</td>
          </tr>
          <tr>
            <th>文章</th>
            <td><?php echo get_articles_count('visiable');?>公开</td>
            <td><?php echo get_articles_count('disabled');?>草稿</td>
          </tr>
          <tr>
            <th>页面</th>
            <td><?php echo get_pages_count('visiable');?>公开</td>
            <td><?php echo get_pages_count('disabled');?>隐藏</td>
          </tr>
          <tr>
            <th>分类</th>
            <td colspan='2'>33</td>
          </tr>
          <tr>
            <th>商品</th>
            <td><?php echo get_products_count('visiable');?>公开</td>
            <td><?php echo get_products_count('disabled');?>隐藏</td>
          </tr>
        </table>
      </div>
      <div id="new_messages">
        <h3>最新留言</h3>
<?php foreach (db_fetch_all("select * from message where status='unread' order by created_at limit 10") as $message) {?>
        <h4><?php echo $message['author'];?> - <small><?php echo $message['created_at'];?></small></h4>
        <blockquote><?php echo $message['content'];?></blockquote>
<?php }?>
        <div id="more_messages"><a href="message.php">More</a></div>
      </div>
      <div id="hot_product">  </div>
      <div id="hot_page">     </div>
      <div id="hot_article">  </div>
    </div>
<?php include 'include/footer.php';?>
<?php require('include/application_bottom.php');?>